/*
* Copyright (C) 2008-2009 J-P Nurmi jpnurmi@gmail.com
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
* License for more details.
*
* $Id: ircsession_p.h 581 2009-05-19 16:40:38Z jpnurmi $
*/

#ifndef IRC_SESSION_P_H
#define IRC_SESSION_P_H

#include <QHash>
#include <QBuffer>
#include <QPointer>
#include <QAbstractSocket>

namespace Irc
{
    class Buffer;
    class Session;
    class ServerBuffer;
    typedef QPointer<Buffer> BufferPointer;

    class SessionPrivate
    {
        Q_DECLARE_PUBLIC(Session)

    public:
        SessionPrivate();

        void _q_connected();
        void _q_disconnected();
        void _q_reconnect();
        void _q_error();
        void _q_state();
        void _q_readData();
        void processLine(const QByteArray& line);

        Session* q_ptr;

        QPointer<QAbstractSocket> socket;

        QString host;
        quint16 port;
        QByteArray encoding;
        QBuffer buffer;
        BufferPointer prevBuffer;

        QPointer<ServerBuffer> serverBuffer;
        QHash<QByteArray, BufferPointer> buffers;
    };
}

#endif // IRC_SESSION_P_H
